package com.qf.tenant.controller;

import com.qf.dto.PageDto;
import com.qf.tenant.entity.Tenant;
import com.qf.tenant.service.TenantService;
import com.qf.vo.PageResult;
import com.qf.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 租户表 前端控制器
 * </p>
 * @author 程序员(李楚枫)
 * @since 2023-10-30
 */
@RestController
@RequestMapping("/tenant")
@CrossOrigin
public class TenantController {

    @Autowired
    private TenantService tenantService;

    /*分页查询*/
    @PostMapping("/page")
    public PageResult<Tenant> page(@RequestBody PageDto<Tenant> pageDto){
        return tenantService.pageInfo(pageDto);
    }

    /*状态修改*/
    @PostMapping("/instruction")
    public Result instrucion(@RequestBody Tenant tenant){
        if (tenantService.updateById(tenant)){
            return new Result(0,"success");
        }else {
            return new Result(1,"fail");
        }
    }
}
